﻿/*
	Copyright (C) 2019 Zongming Liu <1849059316@qq.com>

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License along
	with this program; if not, write to the Free Software Foundation, Inc.,
	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef utility_h__
#define utility_h__

#include <windows.h>
#include <string>

#include "../base/Vector.h"

namespace SkyEngine2d
{
	
	//! 检验 hr 是否为真，为false 会抛出异常
	/*!
	\param HRESULT hr 
	\return void  
	*/
	void checkFailed(HRESULT hr);
	
	//! 检测 hr 是否为真，为false 会抛出异常
	/*!
	\param HRESULT hr 
	\param const char * file_reason 发生异常的原因
	\return void  
	*/
	void checkFailed(HRESULT hr, const char * file_reason);
	
	//! 从引擎坐标转换为渲染坐标
	/*!
	\param const Vector2 & pos 坐标点 
	\return Vector2  
	引擎坐标  以 左下角为 坐标原点 ，渲染坐标 以 左上角为坐标原点 。
	*/
	Vector2 convertToRenderCoordinateVector2(const Vector2 & pos);
	
}
#endif // utility_h__

